/*
* Js模块文件的入口
* by hyi
*/
(function($) {
	var rp = getSearchParams();
	var dataType = rp.dataType || 1;
	var objType = rp.objType ||'';
    var map = new BMap.Map("map", {enableMapClick: false});    // 创建Map实例
	map.setMapStyle(mapStyle);


	map.centerAndZoom("太原", 7);
	// map.centerAndZoom(new BMap.Point(110.66,35.31), 12);  // 初始化地图,设置中心点坐标和地图级别
	map.enableScrollWheelZoom(); // 开启鼠标滚轮缩放

	function initBoundary(){
		var bdary = new BMap.Boundary();
		bdary.get("山西", function(rs){
			var count = rs.boundaries.length; //行政区域的点有多少个
			for(var i = 0; i < count; i++){
				var ply = new BMap.Polyline(rs.boundaries[i], {strokeWeight: 1, strokeColor: "#ffffff"}); //建立多边形覆盖物
				map.addOverlay(ply);  //添加覆盖物
			}
		})
	}
	var mapvLayer;
	var optionsAnimation = {
        fillStyle: '#FFFAF8',
		size: 5,
		draw: 'simple',
	//	bigData: 'Point',
		animation: {
			stepsRange: {start: 0,end: 10},
			trails: 1,
			duration: 3,
		}
	}
	var options = {
		fillStyle: '#FDF832',
		size: 4.5,
		draw: 'simple',
	}
	function initData(){

		let params ={dataType:dataType,objType:objType};
		$.get(baseUrl+"/api/ccid-sxcx/gis/sxcx-key-obj", params,function (rep) {
			if(mapvLayer){
				mapvLayer.destroy();
			}
			let data =rep.data;
			for(var i = 0; i < data.length; i++){
				data[i].time =Math.random() * 10
			}
			mapvLayer = new mapv.baiduMapLayer(map, new mapv.DataSet(data), options);
			
						
			mapvLayer = new mapv.baiduMapLayer(map, new mapv.DataSet(data), optionsAnimation);
		});
	}
//	 initBoundary();
	initData();
})(jQuery)

